//
//  PrepareFooter.m
//  觅尚
//
//  Created by No.8 on 2019/5/22.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "PrepareFooter.h"

@implementation PrepareFooter

-(void)prepare{
    [super prepare];
    
    // 设置普通状态的动画图片
    NSMutableArray *idleImages = [NSMutableArray array];
    for (NSUInteger i = 0; i<=32; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"Loading_%zd", i]];
        [idleImages addObject:image];
    }
    [self setImages:idleImages forState:MJRefreshStateIdle];
    
    // 设置即将刷新状态的动画图片（一松开就会刷新的状态）
    NSMutableArray *refreshingImages = [NSMutableArray array];
    for (NSUInteger i = 0; i<=32; i++) {
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"Loading_%zd", i]];
        [refreshingImages addObject:image];
    }
    [self setImages:refreshingImages forState:MJRefreshStatePulling];
    [self setImages:refreshingImages forState:MJRefreshStateRefreshing];
    
    
//    self.lastUpdatedTimeLabel.hidden = YES;
    //    self.stateLabel.hidden = NO;
    self.stateLabel.hidden = YES;
    self.mj_h = 80;
}

//在这修改图片和label的位置
- (void)placeSubviews
{
    [super placeSubviews];
    self.gifView.contentMode = UIViewContentModeCenter;
    
    //调整图片的位置
    CGRect labelframe = self.stateLabel.frame;
    labelframe.size.height = 15;
    labelframe.origin.y = self.bounds.size.height - 20;
    self.stateLabel.frame = labelframe;
    CGPoint center = self.center;
    center.y = CGRectGetMinY(self.stateLabel.frame) - self.gifView.mj_h / 2.0;
    self.gifView.center = center;
}


@end
